import { queryGasNameList } from "@/api/modules/operation";

/**
 * @description:  获取search配置信息
 * @param {*} type  1 在供气瓶  2 返库气瓶  3 过期气瓶
 * @return {Array<CommonSearch.SearchOption>}
 */
export const useSearchOption = (): Array<CommonSearch.SearchOption> => {
  const chemical: CommonSearch.SearchOption = {
    label: "Chemical",
    key: "chemical",
    value: "",
    type: "select",
    axiosApi: queryGasNameList,
    params: { gasType: "CHEMICAL" },
    mapOption: item => ({ label: item, value: item }),
    placeholder: "请输入Chemical",
    span: 5
  };

  const operationDateStart: CommonSearch.SearchOption = {
    label: "Date",
    key: "operationDateStart",
    realKeys: ["operationDateStart", "operationDateEnd"],
    value: [],
    type: "daterange",
    span: 5
  };

  const confirmor: CommonSearch.SearchOption = {
    label: "确认人",
    key: "confirmor",
    value: "",
    type: "input",
    placeholder: "请输入确认人",
    span: 5
  };

  return [chemical, operationDateStart, confirmor];
};

/**
 * @description:  获取table表格的表头（cloumns）信息
 * @param {*} type  1 在供气瓶  2 返库气瓶  3 过期气瓶
 * @return {Array<CommonTable.TableCloumnsType>}
 */
export const useTableCloumns = (): Array<CommonTable.TableCloumnsType> => {
  const o_1 = { label: "Date", prop: "operationDate", sortable: true, width: 130 };
  const o_2 = { label: "Chemical", prop: "chemical", width: 120 };
  const o_3 = { label: "DrumA", prop: "drumA", width: 80 };
  const o_4 = { label: "DrumB", prop: "drumB", width: 80 };
  const o_5 = { label: "合计", prop: "drumTotal", width: 80 };
  const o_6 = { label: "Lot Number", prop: "lotNumber", width: 120 };
  const o_7 = { label: "生产日期", prop: "productionDate", sortable: true, width: 100 };
  const o_8 = { label: "有效日期", prop: "expirationDate", sortable: true, width: 100 };
  const o_9 = { label: "操作人", prop: "operator", width: 80 };
  const o_10 = { label: "	确认人", prop: "confirmor", width: 80 };
  const o_11 = { label: "备注", prop: "remark", width: 150 };
  return [o_1, o_2, o_3, o_4, o_5, o_6, o_7, o_8, o_9, o_10, o_11];
};
